←Select platform

ConvertDirect(ConversionColorFormat,ConversionColorFormat,byte[],int,byte[],int,int,int,int,int) Method

Summary

Converts image data in a managed buffer from one color conversion model directly to another, using built-in algorithms.

Syntax
C#
C++/CLI
Python
public static void ConvertDirect( 
   ConversionColorFormat srcFormat, 
   ConversionColorFormat destFormat, 
   byte[] srcBuffer, 
   int srcBufferOffset, 
   byte[] destBuffer, 
   int destBufferOffset, 
   int width, 
   int height, 
   int inAlign, 
   int outAlign 
) 
public:  
   static void ConvertDirect( 
       ConversionColorFormat^ srcFormat, 
      ConversionColorFormat^ destFormat, 
      array<Byte>^ srcBuffer, 
      int srcBufferOffset, 
      array<Byte>^ destBuffer, 
      int destBufferOffset, 
      int width, 
      int height, 
      int inAlign, 
      int outAlign 
   ) 

Parameters

srcFormat

Format of the input data.

destFormat

Format of the output data.

srcBuffer

A pointer to the buffer containing the input data.

srcBufferOffset

Offset to the first byte of the srcBuffer data buffer.

destBuffer

A pointer to the buffer containing the output data.

destBufferOffset

Offset to the first byte of the destBuffer data buffer.

width

Width of pixels to be processed.

height

Height of pixels to be processed.

inAlign

Each scanline in the input buffer is a multiple of inAlign bytes.

outAlign

Each scanline in the output buffer is a multiple of outAlign bytes.

Remarks

There is no need to call the Start and Stop methods to initialize or stop the conversion engine.

Converting from any color space to YCCK color space is currently not supported.

For more information about Alignment Parameters, refer to Alignment Parameters.

To convert to the Y41P type the input buffer length must be a multiple of 8.

Example

This example will convert a CMYK color to an RGB color, using the ConvertDirect static method.

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ColorConversion; 
 
using Leadtools.ImageProcessing; 
 
public void ConvertDirectExample() 
{ 
   // StartUp the Color Conversion Engine 
   RasterColorConverterEngine.Startup(); 
 
   // RGB and CMYK color buffer arrays 
   byte[] cmykColor = { 100, 100, 100, 100 }; // Input buffer 
   byte[] rgbColor = new byte[3]; // Output buffer 
             
   // Direct conversion from CMYK to RGB using default built-in options 
   RasterColorConverterEngine.ConvertDirect(ConversionColorFormat.Cmyk, // Source format 
      ConversionColorFormat.Rgb, // Destination format 
      cmykColor, // Input buffer 
      0, // Offset from the beginning of the source buffer 
      rgbColor, // Output buffer 
      0, // Offset from the beginning of the destination buffer 
      1, // Pixels width 
      1, // Pixels height 
      0, // Scanline alignment for input buffer 
      0); // Scanline alignment for output buffer 
 
   Debug.WriteLine("Converted RGB value: " + rgbColor[0] + ' ' + rgbColor[1] + ' ' + rgbColor[2]); 
 
   // Shutdown the ColorConversion. 
   RasterColorConverterEngine.Shutdown(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ColorConversion Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.